package main

import "fmt"

func main() {
	base()
}
func base() {
	var x interface{}
	var b float64 = 1.1
	//把 b 赋值给 x 空接口
	x = b
	//将 x 重新转为 float 类型
	y := x.(float64)
	fmt.Printf("y 的类型%T\n", y)
	//y2 := x.(float32)
	//panic: interface conversion: interface {} is float64, not float32
	//fmt.Printf("y2的类型%T", y2)

	y3, ok := x.(float32)
	if ok {
		fmt.Printf("y3的类型%T\n", y3)
	} else {
		fmt.Println("x 不是 float32类型")
	}
}
